<form class="form-horizontal" method="post">
	
	<input type="hidden" name="action" value="grant_board" />
	<input type="hidden" name="idx" value="<?php echo $result['idx']?>" />

	<div class="btn-group" style="margin-bottom:30px">
		<a href="<?php echo $href?>/<?php echo $kong->id ?>/board/<?php echo $result['id']?>" class="btn">기본</a>
		<a href="<?php echo $href?>/<?php echo $kong->id ?>/board/<?php echo $result['id']?>/category" class="btn">카테고리</a>
		<a href="<?php echo $href?>/<?php echo $kong->id ?>/board/<?php echo $result['id']?>/grant" class="btn disabled">권한</a>
	</div>

<?php
$grant_list_k = explode("|", "list|view|write|modify|delete|secret|commentwrite|commentdelete");
$grant_list_v = explode("|", "목록보기|글읽기|글쓰기|글수정|글삭제|비밀글읽기|코멘트쓰기|코멘트삭제");

$cnt = count($grant_list_k);
for ($i = 0; $i < $cnt; $i++) :
?>
	<div class="control-group">
		<label class="control-label"><?php echo $grant_list_v[$i]?></label>
		<div class="controls">
			<label class="checkbox inline"><input name="<?php echo $grant_list_k[$i]?>[]" value="0" type="checkbox"<?php if ( isset($grant[$grant_list_k[$i]]) && in_array(0, $grant[$grant_list_k[$i]]) ) echo " checked"?> /> 모든회원</label>
<?php foreach ($group as $v) : // Error Processing. ?>
			<label class="checkbox inline"><input name="<?php echo $grant_list_k[$i]?>[]" value="<?php echo $v['idx']?>" type="checkbox"<?php if ( isset($grant[$grant_list_k[$i]]) && in_array($v['idx'], $grant[$grant_list_k[$i]]) ) echo " checked"?> /> <?php echo $v['name']?></label>
<?php endforeach; ?>
		</div>
	</div>

<? endfor; ?>	
	
	<div class="control-group">
		<div class="controls">
			<button type="submit" name="submit" id="submit" class="btn btn-warning">수정</button>
		</div>
	</div>
</form>